<template>
    <!-- <dv-border-box13 class="left-center-chart-container1"> -->
    <div class="left-chart-1">
        <div class="lc1-header">
            <dv-decoration-6 class="lc1-de" />
            <div>托管主体服务概况</div>
            <dv-decoration-6 class="lc1-de" />
        </div>
        <div class="lc1-chart">
            <line-chart :options="barOptions" style="width: 100%; height: 200px;"></line-chart>
        </div>

    </div>
    <!-- </dv-border-box13> -->
</template>

<script setup name="servicePlanterBar">
import { ref, computed } from 'vue';
import LineChart from '@/views/dashboard/components/datav/LineChart.vue';
import { listPlanterServiceSummary } from '@/api/statistics/plant_service';
import dayjs from "dayjs";


const currentYear = dayjs().year().toString();

const labelOption = {
    show: true,
    position: 'insideBottom',
    distance: 15,
    align: 'left',
    verticalAlign: 'middle',
    rotate: 90,
    formatter: '{c}  {name|{a}}',
    fontSize: 12,
    rich: {
        name: {}
    }
};

const queryParams = {
    year: currentYear,
}

const barOptions = reactive({
    title: {
        text: ''
    },
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            type: 'shadow'
        }
    },
    legend: {
        textStyle: {
            color: '#fff'
        }
    },
    xAxis: [
        {
            type: 'category',
            axisTick: { show: true },
            nameTextStyle: {
                color: '#fff',
                fontSize: 10
            },
            data: []
        }
    ],
    yAxis: [
        {
            type: 'value'
        }
    ],
    series: []
})



function getList() {
    listPlanterServiceSummary({ "year": currentYear }).then(response => {
        console.log("response", response);
        barOptions.xAxis[0].data = response.others;
        barOptions.series = response.rows;

    });
}



getList();
</script>

<style lang="scss" scoped>
.left-chart-1 {
    width: 100%;
    // height: 30%;
    display: flex;
    // flex-grow: 0;
    flex-direction: column;
    height: 300px;
    // background-color: yellow;
    padding: 20px;

    .lc1-header {
        text-align: center;
        height: 30px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 18px;
        margin-bottom: 20px;
    }

    .lc1-de {
        height: 20px;
        width: 180px;
        display: flex;
        justify-content: center;
    }

    // .lc1-details {
    //     height: 50px;
    //     font-size: 16px;
    //     display: flex;
    //     align-items: center;
    //     text-indent: 20px;

    //     span {
    //         color: #096dd9;
    //         font-weight: bold;
    //         font-size: 35px;
    //         margin-left: 20px;
    //     }
    // }

    // .lc1-chart {
    //     // flex: 1;
    // }
}
</style>
